package com.qifei.xmlg_backend.controller;

import com.qifei.xmlg_backend.entity.Result;
import com.qifei.xmlg_backend.utils.minio.MinioUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 通用
 */
@RestController
@RequiredArgsConstructor
public class UploadController {

    private final MinioUtils minioUtils;

    /**
     * 图片上传
     */
    @PostMapping("/upload")
    public Result<?> upload (MultipartFile image) throws Exception{
        String url = minioUtils.upload(image);
        return Result.success(url);
    }

}
